import { instance } from '../request'

const request = instance

/**
 * 创建项目
 * @param name 项目名称
 * @param description 项目描述
 * @returns
 */
export const addProjectApi = (name: string, description: string): PromiseRes =>
  request.post('/project/add', { name, description })

/**
 *修改项目
 * @param id 项目id
 * @param name 项目名称
 * @param description 项目描述
 * @returns
 */
export const updateProjectApi = (
  id: string,
  name: string,
  description: string
): PromiseRes => request.post('/project/update', { id, name, description })

/**
 *删除项目
 * @param id 项目id
 * @returns
 */
export const deleteProjectApi = (id: string): PromiseRes =>
  request.post(`/project/delete?projectId=${id}`)

/**
 * 获取项目列表
 * @returns
 */
export const getProjectsApi = (): PromiseRes<ProjectItf[]> =>
  request.get(`/project/get`)
